/*
 * Copyright (C) 2010, Funcom AS, All Rights Reserved
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  @authors
 *  Svein Gunnar Larsen <sveingunnarlarsen@gmail.com>
 *  Erik Thune Lund <culex.eriklund@gmail.com>
 *  Michel Krohn-Dale <kronicz@gmail.com>
 */

package com.funcom.peeler.utils;

import com.jme.renderer.Renderer;
import com.jmex.bui.BComponent;
import org.lwjgl.opengl.GL11;

import java.awt.*;

public class SelectorBox extends BComponent {

    public Point start = new Point();
    public Point end = new Point();

    /**
     * Render a selection box
     * @param renderer Renderer
     */
    public void render( Renderer renderer ) {

        GL11.glColor3f( 0, 0, 0 );
        GL11.glEnable( GL11.GL_LINE_STIPPLE );

        GL11.glLineWidth( 2 );
        GL11.glPushAttrib( GL11.GL_LINE_BIT );
        GL11.glLineStipple( 4, (short)0xAAAA );
        GL11.glBegin( GL11.GL_LINE_LOOP );
        GL11.glVertex2f( start.x, start.y );
        GL11.glVertex2f( end.x, start.y );
        GL11.glVertex2f( end.x, end.y );
        GL11.glVertex2f( start.x, end.y );
        GL11.glEnd();
    }
}
